package com.performanceManagement.pojo;


import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;


@DynamicInsert  //允许设置默认值
@DynamicUpdate

@Data  
@AllArgsConstructor
@NoArgsConstructor
@Entity(name="PerformanceManagement")  //表明这是一个实体类,并与数据库进行映射
@ExcelTarget("绩效信息表")     //无意义，仅为Excel导出时的为其声明唯一的一个Id
public class PerformanceManagement implements Serializable {

    @Id  //id值唯一
    @GeneratedValue(strategy = GenerationType.IDENTITY)  //主键生成策略，默认自增

    private Integer pId;


    @ExcelEntity //声明其存在实体对象
    @ManyToOne  //多对一
    @JoinColumn(name = "eId")  //指定外键列名称
    private EmployeeInformation employeeInformation;

    @Excel(name = "是否请假")
    @Column(nullable = false,columnDefinition="varchar(20) default '否'")  //设置数据库对象的属性
    private String isAskForLeave;

    @Excel(name = "是否迟到")
    @Column(nullable = false,columnDefinition="varchar(20) default '否'")
    private String isLate;

    @Excel(name = "是否旷工")
    @Column(nullable = false,columnDefinition="varchar(20) default '否'")
    private String isAbsent;

    @Excel(name = "是否早退")
    @Column(nullable = false,columnDefinition="varchar(20) default '否'")
    private String isLeaveEarly;

    @Excel(name = "工作态度")
    @Column(nullable = false,columnDefinition="varchar(20) default '优秀'")
    private String workAttitude;

    @Excel(name = "工作完成度")
    @Column(nullable = false,columnDefinition="varchar(20) default '优秀'")
    private String workCompleteness;

    @Excel(name = "绩效时间",format="yyyy-MM-dd HH:mm:ss")
    @Column(length=20)

    private Date pDate;

    //因驼峰命名法easyexcel的get/set方法 与lombok冲突，因此使用方法。
    public Integer getpId() {
        return pId;
    }

    public void setpId(Integer pId) {
        this.pId = pId;
    }


    public Date getpDate() {
        return pDate;
    }

    public void setpDate(Date pDate) {
        this.pDate = pDate;
    }
}
